package com.agranee.timemanagementsystem.util;

import org.apache.log4j.Logger;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
	private static final SessionFactory sessionfactory = buildSessionfactory();
//	private static final Logger logger=Logger.getLogger(HibernateUtil.class);

	public static SessionFactory buildSessionfactory() {
		try{
	//	logger.info("Hibernate Session creating");
		return new AnnotationConfiguration().configure()
				.buildSessionFactory();
		}catch (Throwable e) {
		//	logger.error("Hibernate Session problem");
			throw new ExceptionInInitializerError(e);
		}

	}

	public static SessionFactory getSessionfactory() {
		return sessionfactory;
	}

}